<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableSysConfig extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_configs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->default('')->nullable(false)->comment('设置名称');
            $table->string('key')->default('')->nullable(false)->comment('设置关键词');
            $table->string('content')->default('')->nullable(false)->comment('设置内容');
            $table->timestamps();
        });
        DB::statement("alter table `sys_configs` comment '系统设置信息' ");

        Schema::create('searches', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('uid')->default(0)->nullable(false)->comment('用户ID');
            $table->string('content')->default('')->nullable(false)->comment('搜索内容');
            $table->timestamps();
        });
        DB::statement("alter table `searches` comment '搜索记录表' ");

        Schema::create('messages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('touid')->default(0)->nullable(false)->comment('发送对象Uid');
            $table->string('content')->default('')->nullable(false)->comment('消息体');
            $table->integer('msgtype')->default(0)->nullable(false)->comment('消息类型:1系统通知');
            $table->integer('title')->default(0)->nullable(false)->comment('消息标题');
            $table->timestamps();
        });
        DB::statement("alter table `messages` comment '消息记录表' ");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_configs');
        Schema::dropIfExists('searches');
        Schema::dropIfExists('messages');
    }
}
